home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / util / rexx / RXListReq.lha / RXListReq / lvtest.rexx next >
Encoding:
OS/2 REXX Batch file  |  1998-09-04  |  5.4 KB  |  102 lines

  1. /* *********************************************** */
  2. /* lvtest.rexx                                     */
  3. /* Author: Bob Dickow (dickow@uidaho.edu)          */
  4. /* $VER: lvtest.rexx V1.0 (09.04.98)               */
  5. /* *********************************************** */
  6.  
  7. /* ************************************************************ */
  8. /*   Simple arexx script to test and demo rxlistreq host.       */
  9. /*   The host will display a gadtools listview in a window      */
  10. /*   and displays a list specified by the calling arexx script. */
  11. /*                                                              */
  12. /*   After the user clicks on an item or cancels the requester, */
  13. /*   the host will return control to the calling arexx program. */
  14. /* ************************************************************ */
  15.  
  16. /* *********************************************************************** */
  17. /* USAGE: Start up the rxlistreq host through a shell command, then        */
  18. /* address the host as ADDRESS "RXLISTREQ" (or if you want to specify      */
  19. /* a host name, add it after the shell callup of rxlistreq as a cli        */
  20. /* parameter: run rxlistreq LISTVIEW)                                      */
  21. /* Then 'send' the command, after using ADDRESS "<PORTNAME>" as:           */
  22. /*  rxlistreq <NUMBER_IN_LIST> <LIST_STEM_NAME> [WINDOW_PARMS_STEMNAME]    */
  23. /*                                                                         */
  24. /*  The last parameter is optional, and will default to "RXLV"             */
  25. /* Parameters:                                                             */
  26. /*  <NUMBER_IN_LIST>: This number tells the host to show a list with the   */
  27. /*      specified number of elements. The AREXX calling script or program  */
  28. /*      must declare a list as a stem variable indexed from 0, as in:      */
  29. /*      STEM.0 = "Hello" ; STEM.1 = "GOODBYE" ; STEM.2 = "342" ....        */
  30. /*      The host will use the stem name in the parameter, with no default  */
  31. /*      to fall back to.                                                   */
  32. /*  <LIST_STEM_NAME>: The AREXX stem variable name for the list of items.  */
  33. /*      This list should be indexed from 0, and may continue to any ex-    */
  34. /*      tent. The indexes should be successive integer numbers (1, 2 etc)  */
  35. /*  <WINDOW_PARMS_STEMNAME>: This is an optional stem variable name that   */
  36. /*      the script can use to pass various parameters for the listview     */
  37. /*      window display. The default stem is "RXLV". The choices are:       */
  38. /*                                                                         */
  39. /*  RXLV.LVLABEL       -- A String to place above the listview             */
  40. /*  RXLV.BUTTONLABEL   -- A String to place inside the CANCEL button       */
  41. /*  RXLV.XPOS          -- The screen X position to open the window         */
  42. /*  RXLV.YPOS          -- The screen Y position to open the window         */
  43. /*                        (if not specified, opens near the mouse pointer) */
  44. /*  RXLV.WIDTH         -- The desired width of the window                  */
  45. /*  RXLV.HEIGHT        -- The desired height of the window                 */
  46. /*                        (Will not be smaller than 150 x 200 pixels)      */
  47. /*  RXLV.SCREEN        -- Name of the public screen on which to display    */
  48. /*                        the window. Default is the Workbench.            */
  49. /* *********************************************************************** */
  50.  
  51. /* ***************************************************************************** */
  52. /* The rxlistreq host program returns the following variables, which will        */
  53. /* be created in the symbol table if not already declared:                       */
  54. /* [RXLV].CLICKED = number of the item chosen, unset if user cancels or quits.   */
  55. /* [RXLV].EXIT    = key (or the close gadget) that the user used to exit, if     */
  56. /*    the user decides to abort the window and not make a choice from the        */
  57. /*    list. Currently the user may abort by clicking the close gadget or         */
  58. /*    the CANCEL button gadget, or by typing the ESC key or the HELP key.        */
  59. /*    EXITCHOICE will be set to strings "CANCEL, CLOSE, ESC, or HELP"            */
  60. /*    respectively, or to LIST if the listview is clicked.                       */
  61. /* ***************************************************************************** */
  62.  
  63. ADDRESS COMMAND
  64.  
  65. options results
  66.  
  67. 'run rxlistreq' /* add an addition cli parameter to specify your own address choice */
  68.  
  69. 'waitforport RXLISTREQ' /* the default address */
  70.  
  71. ADDRESS "RXLISTREQ"
  72.  
  73. /* set up your array for the listview */
  74.  
  75. Listus.0 = "Choice #1 (index 0)"
  76. Listus.1 = "Choice #2 (index 1)"
  77. Listus.2 = "Choice #3 (index 2)"
  78.  
  79. RXLV.LVLABEL = "Click Your Choice" /* "Click to Select" by default */
  80. RXLV.BUTTONLABEL = "I'm Done"  /*  "Cancel" by default */
  81. RXLV.XPOS = -1   /* Set to open at x position, or -1 for mouse pos */
  82. RXLV.YPOS = -1   /* Set to open at y position, or -1 for mouse pos */
  83. RXLV.WIDTH = 175  /* default = 150 */
  84. RXLV.HEIGHT = 240 /* default = 200 */
  85. RXLV.SCREEN = "WorkBench" /* The default pubscreen anyway */
  86. /* RXLV.SCREEN = "FinalWriterPubScreen" */ /* ...for example  */
  87.  
  88. rxlistreq 3 LISTUS RXLV  /* the command that rxlistreq will parse */
  89.  
  90. ADDRESS
  91.  
  92. say "The Host returned" RC "in RC"
  93.  
  94. If RXLV.EXIT == "LIST" then DO
  95.   CLICKED = RXLV.CLICKED  /* N.B.No variable substitution, sorry */
  96.   say "Item Clicked=" CLICKED "VALUE=" LISTUS.CLICKED
  97.   END
  98. ELSE  /* the user decide not to click on a listview item */
  99.   IF RC = 0 then say "The user hit" RXLV.EXIT
  100. exit
  101.  
  102.